package com.android.project.framework.util;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DatabaseHelper extends SQLiteOpenHelper {
	
	 private static final String DATABASE_NAME = "mydatabase.db";
     private static final int DATABASE_VERSION = 1;

  
     private static final String DATABASE_CREATE = "create table association (_id integer primary key autoincrement, " +
     		"word1 text not null, word2 text not null, peso text not null);";

  // Costruttore
     public DatabaseHelper(Context context) {
    	
          super(context, DATABASE_NAME, null, DATABASE_VERSION);
    	// Log.d("database", "" + "creato");
     }

	@Override
	public void onCreate(SQLiteDatabase database) {
		// TODO Auto-generated method stub
		database.execSQL(DATABASE_CREATE);
		
	}

	@Override
	public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		 database.execSQL("DROP TABLE IF EXISTS association");
         onCreate(database);
		
	}

}
